<template>
	<view class="page addNews">
		<view class="form-container mb-30">
			<view class="form-item line-b">
				<view class="label" >车队名称<text class="c-ff6">*</text></view>
				<view class="right">
					<input type="text" placeholder="请输入" v-model="cdname"/>
				</view>
			</view>
		
			
		<view class="pdtb-30 bg-f fz24 c-ff6 tac" @click="ok">创建车队</view>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cdname:'',
				uid:'',
				
			};
		},
		onLoad(e) {
			this.uid = uni.getStorageSync('uid');
		},
		
		methods: {
			async ok() {
				if(this.cdname==''){
					uni.showToast({
					  title:  '请输入车队名称',	
					  icon:'none',
					  duration: 2000,
				
					});
					return false;
				}
				
				
				let res =  await this.$api.addcd({cdname:this.cdname,uid:this.uid})
				if(res.data.code==0){
					uni.showToast({
					  title:  res.data.msg,	
					  icon:'none',
					  duration: 2000,
					  success:function(obj){
					  uni.navigateTo({
				
						url:'/pages/index/index'
					  })
					  }
					});
					
				}else{
					uni.showToast({
					  title: res.data.msg,	
					  icon:'none',
					  duration: 2000
					});
				}
			}
		}
	}
</script>

<style lang="scss">

</style>
